﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace WebApplication3
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //comentario desde ntebook
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection conexion =new SqlConnection("Data Source=USUARIO-PC\\SQLEXPRESS;Initial Catalog=patiodecomidas;Integrated Security=True;Pooling=False");

            conexion.Open();

            String desc=TextBox1.Text.ToString();

            int cmenu=(int)DropDownList1.SelectedIndex+1;
            int cbebida=(int)DropDownList2.SelectedIndex+1;
            int cpostre=(int)DropDownList3.SelectedIndex+1;



            SqlCommand comando = new SqlCommand("insert into Pedido (cod_menu, cod_bebidas,cod_postre,descripcion) values ('" + cmenu + "','" + cbebida + "','" + cpostre + "','"+desc+"')", conexion);

            if (comando.ExecuteNonQuery() > 0)
                Label1.Text = "Pedido gualdado con éxito";
            else
                Label1.Text = "Error al tomar el pedido";

            conexion.Close();



        }
    }
}